@extends('layouts.page')
@section('css')
     {{ HTML::style('assets/css/app.css?version=1') }}
@stop

@section('main')
<header id="m-header" class="am-cf {{empty($home) ? '' : 'home'}}">
	<div class="am-container am-cf" id="m-header-hd">
		<form action="{{URL::to('search')}}" method="post">
			<input type="text" name="q" placeholder="搜索" autocomplete="off"> 
			{{Form::token()}}
		</form>
		<nav class="am-cf">
			<ul>
			   @if(!empty($notice))
				<li class="m-nav-notice">{{$notice->title}}</li>
			   @endif
				<li class='m-nav-user'>
					<span id="login" data-show-login="{{empty($login) ? false : $login}}">登录/注册</span>
				</li>
				<li class="m-nav-split">
					<span>|</span>
				</li>
				<li class="m-nav-cart">购物车<span class="m-cart-size"> (0)</span></li>
			</ul>
		</nav>
	</div>
</header>

<div id="m-main-wrap" class="am-container {{empty($home) ? '' : 'home'}}">
<div id="m-main" class="{{empty($home) ? '' : 'home'}}">
  <!-- sidebar start -->
  @if(!empty($home))
  	@include('front.home-sidebar', array('tree'=>$tree))
  @else
  	<div id="m-sidebar">
  	<a href="{{URL::to('/')}}"><img src="{{URL::to('assets/i/logo-default.png')}}" alt="蔓茂花廊" class="m-logo"></img></a>
    <ul class="am-list am-list-static">
      <li class="m-parent"><span><a href="{{URL::to('/stories')}}" class=" {{isset($storyId) && $storyId == 0 ? 'active' : ''}}">The Stories</a></span></li>
      @foreach ($projects as $pp)
      <li class="m-parent">
      	@if(count($pp->children) > 0 && empty($home))
	      	<span class="am-cf" data-am-collapse="{target: '#project-{{$pp->id}}'}">
	      		<span><a href="#"
	      				style="{{!empty($pp->color) ? 'color:'.$pp->color.';' : ''}}">{{$pp->name}}</a></span> 
	        	<span class="am-fr collapse-icon m-slidbar-icon">
	        	@if(!empty($storyId))
	        	-
        		@else
        		+
        		@endif
	        	</span>
	        </span>
	        <ul class="am-list am-collapse m-sidebar-sub {{!empty($storyId)? 'am-in' : ''}}" id="project-{{$pp->id}}">
	           @foreach ($pp->children as $child)
	           <li><a href="{{$child->url}}" 
	           			class="{{!empty($storyId) && $storyId == $child->id ? 'active' : ''}}"
	           			style="{{!empty($child->color) ? 'color:'.$child->color.';' : ''}}">{{$child->name}}</a></li>
	           @endforeach
	        </ul>
      	@else
      		<span><a href="{{$pp->url}}"
      				style="{{!empty($pp->color) ? 'color:'.$pp->color.';' : ''}}">{{$pp->name}}</a></span>
      	@endif
      </li>
      @endforeach
 
 	  <!-- 
      <li class="m-parent"><span><a href="{{URL::to('/product-list')}}" class=" {{!empty($all) ? 'active' : ''}}">所有商品</a></span></li>
       -->
      @foreach ($tree as $parent)
      <li class="m-parent">
      	@if(count($parent->children) > 0 && empty($home))
	      	<span class="am-cf">
	      		<span><a href="{{URL::to('/product-list',$parent->id)}}" 
	      		class=" {{!empty($category) && $parent->id == $category->id  ? 'active' : ''}}"
	      		style="{{!empty($parent->color) ? 'color:'.$parent->color.';' : ''}}">{{$parent->name}}</a></span> 
	        	<span class="am-fr collapse-icon m-slidbar-icon" 
	        		data-am-collapse="{target: '#category-{{$parent->id}}'}">
	        		@if(!empty($expandId) && $parent->id == $expandId)
	        		-
	        		@else
	        		+
	        		@endif
	        	</span>
	        </span>
	        <ul class="am-list am-collapse m-sidebar-sub {{!empty($expandId) && $parent->id == $expandId  ? 'am-in' : ''}}" id="category-{{$parent->id}}">
	           @foreach ($parent->children as $child)
	           <li><a href="{{URL::to('/product-list',$child->id)}}" 
	           			class="{{!empty($category) && $child->id == $category->id  ? 'active' : ''}}"
	           			style="{{!empty($child->color) ? 'color:'.$child->color.';' : ''}}">{{$child->name}}</a></li>
	           @endforeach
	        </ul>
      	@else
      		<span><a href="{{URL::to('/product-list',$parent->id)}}" 
      				class="{{!empty($category) && $parent->id == $category->id  ? 'active' : ''}}"
      				style="{{!empty($parent->color) ? 'color:'.$parent->color.';' : ''}}">{{$parent->name}}</a></span>
      	@endif
      </li>
      @endforeach
    </ul>
  </div>
  @endif
  <!-- sidebar end -->

  <!-- content start -->
  <div id="m-content" class="am-cf {{empty($home) ? '' : 'home'}}">
  	@section('content')
	@show
  </div>
  <!-- content end -->
</div>
</div>
<footer class="" id="m-footer">
	<ul class="am-text-left">
		<li class="left">&copy; {{date('Y',time())}} MAGGIE MAO The Floral Art</li>
		<a href="{{URL::to('privacy')}}"><li class="left">隐私声明</li></a>
		<li class="split">|</li>
		<a href="{{URL::to('terms')}}"><li>条款条件</li></a>
	</ul>
	<ul class="am-text-center">
		<a href="{{URL::to('about')}}"><li>关于花廊</li></a>
		<li class="split">|</li>
		<a href="{{URL::to('guide')}}"><li>购买指南</li></a>
		<li class="split">|</li>
		<a href="{{URL::to('contact')}}"><li>联系我们</li></a>
		<li class="split">|</li>
		<a href="{{URL::to('faq')}}"><li>常见问题</li></a>
	</ul>
	<ul class="am-text-right">
		<li class="right">苏ICP备16012000号</li>
	</ul>
</footer>

<div class="am-modal am-modal-no-btn m-dialog" tabindex="-1" id="dialog">
  <div class="am-modal-dialog">
    <div class="am-modal-hd">
      <a href="javascript: void(0)" class="am-close" data-am-modal-close>&times;</a>
    </div>
    <div class="am-modal-bd">
    </div>
  </div>
</div>




@stop

@section('common-script')
{{ HTML::script('assets/js/affix.js') }}
<!-- 通知start -->
<script type="text/x-handlebars-template" id="notice-tpl">
<div class="m-notice">
<h3 class="m-notice-hd"><span class='enname'>NOTICE </span> <b>通知</b></h3>
<div class="m-notice-bd">
	@if(!empty($notice))
	{{$notice->content}}
	@endif
</div>
</div>
</script>
<script type="text/x-handlebars-template" id="login-tpl">
<div class="m-login am-cf">
<h2>登录/注册</h2>
<div class="m-login-bd">
	<div class="m-login-login">
		<h3>已注册用户</h3>
		<p>请输入您的手机号/邮箱和密码来登录。</p>
		<form class="am-form" id="login-form" name="login-form" 
				method="post" action="{{URL::to('login')}}">
			<div class="am-form-group">
		      <label for="mobile">登录账户</label>
		      <input type="text" class="m-input validate" id="mobile" name="mobile"
				data-rules="required" data-display="登录账户" placeholder="输入手机号/邮箱">
		    </div>
		    <div class="am-form-group">
		      <label for="password">密码</label>
		      <input type="password" class="m-input validate" id="password" name="password"
				data-display="密码" data-rules="required" placeholder="输入密码">
		    </div>
			{{Form::token()}}
	        <input type="hidden" name="guest" value="{{empty($login) ? 0 : $login}}"/>
			<p id="forgot-password" class="m-forgot-password">忘记密码?</p>
		    <p><button type="submit" class="m-btn">提交</button></p>
		    <p class="m-form-error"></p>
		</form>
	</div>
	<div class="m-login-reg">
		<h3>新用户</h3>
		<p>如果您还不是我们的用户，请在此注册。</p>
		<p><button type="button" class="m-btn" id="register-btn">注册</button></p>
	</div>
</div>
</div>
</script>
<script type="text/x-handlebars-template" id="forgot-tpl">
<div class="m-login-forgot">
	<h3>在这里修改密码</h3>
    <!--
	<p>请填写您用于注册账户的电子邮箱地址，我们将会发送一封邮件到您的邮箱，以便您重置密码。</p>
    -->
	<form class="am-form" id="forgot-form" name="forgot-form" method="post" action="{{URL::to('forgot')}}">
		<div class="am-form-group" id="forgot-mobile">
		      <label for="mobile">手机号<span class="m-required">*</span></label>
			<div class="am-cf m-horizontal-group">
		      <input type="text" class="m-input validate" id="mobile" name="mobile"
				data-rules="required|mobile" data-display="手机号" placeholder="输入手机号">
			  <span class="m-field-error"></span>
            </div>
		</div>
    
       <div class="am-form-group m-verify-code-group" id="forgot-code">
		      <label for="verifyCode">验证码<span class="m-required">*</span></label>
		      <div class="am-cf m-horizontal-group">
			  <input type="text" class="m-input validate" id="verifyCode" name="verifyCode" 
				data-rules="required" data-display="验证码" placeholder="输入验证码">
              <div class="am-input-group-btn">
                 <button class="am-btn am-btn-default" type="button">获取验证码</button>
              </div>
			  <span class="m-field-error"></span>
			  </div>
		</div>
        
        <div class="am-form-group">
		      <label for="password">新密码<span class="m-required">*</span></label>
			<div class="am-cf m-horizontal-group">
		      <input type="password" class="m-input validate" id="password" name="password" 
				data-rules="required|min_length[6]|max_length[64]|alpha_dash|matches[password_confirmation]" data-display="密码" placeholder="密码最少6位(字母,数字,下划线,破折号)">
              <span class="m-field-error"></span>
            </div>
		</div>
	    <div class="am-form-group">
		      <label for="password_confirmation">确认密码<span class="m-required">*</span></label>
			  <div class="am-cf m-horizontal-group">
		      <input type="password" class="m-input validate" id="password_confirmation" name="password_confirmation" 
					data-rules="required" data-display="确认密码" placeholder="输入密码">
				 <span class="m-field-error"></span> 
			</div>
	    </div>
        <!--
		<p class="m-form-error"></p>
        -->
		{{Form::token()}}
		<p><button type="submit" class="m-btn" id="forgot-btn">密码修改</button></p>
	</form>
</div>
</script>
<script type="text/x-handlebars-template" id="message-tpl">
<div class="m-login-forgot">
	<h3>密码修改成功</h3>
	<!--
	<p class="m-title">密码修改成功！</p>
	-->
	<p class="m-message">您现在可以使用新密码进行登录。</p>
	<p style="height:60px;"></p>
	<p><button type="button" class="m-btn" id="close-boxer-btn">关闭</button></p>
</div>
</script>

<script type="text/x-handlebars-template" id="register-tpl">
<h2>登录注册</h2>
<div class="m-login-bd">
	<div class="m-register">
		<form class="am-form"  id="register-form" name="register-form" method="post" 
				action="{{URL::to('register')}}">
			<div class="am-form-group">
		      <label for="name">姓名<span class="m-required">*</span></label>
			  <div class="am-cf m-horizontal-group">
		      <input type="text" class="m-input validate" id="name" name="name" 
				data-rules="required|max_length[32]" data-display="姓名" placeholder="输入姓名">
			  <span class="m-field-error"></span>
              </div>
			  
		    </div>
			<div class="am-form-group" id="register-mobile">
		      <label for="mobile">手机<span class="m-required">*</span></label>
		      <div class="am-cf m-horizontal-group">
			 <input type="text" class="m-input validate" id="mobile" name="mobile" 
				data-rules="required|mobile" data-display="手机号" placeholder="输入手机号">
			  <span class="m-field-error"></span>
			  </div>
			</div>

			<div class="am-form-group m-verify-code-group" id="register-code">
		      <label for="verifyCode">验证码<span class="m-required">*</span></label>
		      <div class="am-cf m-horizontal-group">
			  <input type="text" class="m-input validate" id="verifyCode" name="verifyCode" 
				data-rules="required" data-display="验证码" placeholder="输入验证码">
              <div class="am-input-group-btn">
                 <button class="am-btn am-btn-default" type="button">获取验证码</button>
              </div>
			  <span class="m-field-error"></span>
			  </div>
			</div>
		
			<div class="am-form-group">
		      <label for="email">邮箱<span class="m-required">*</span></label>
			 <div class="am-cf m-horizontal-group">
		      <input type="text" class="m-input validate" id="email" name="email" 
				data-rules="required|max_length[128]|valid_email" data-display="电子邮箱" placeholder="输入电子邮箱">
              <span class="m-field-error"></span>
	          </div>
		    </div>
		    <div class="am-form-group">
		      <label for="password">密码<span class="m-required">*</span></label>
			<div class="am-cf m-horizontal-group">
		      <input type="password" class="m-input validate" id="password" name="password" 
				data-rules="required|min_length[6]|max_length[64]|alpha_dash|matches[password_confirmation]" data-display="密码" placeholder="密码最少6位(字母,数字,下划线,破折号)">
              <span class="m-field-error"></span>
            </div>
		    </div>
			<div class="am-form-group">
		      <label for="password_confirmation">确认密码<span class="m-required">*</span></label>
			  <div class="am-cf m-horizontal-group">
		      <input type="password" class="m-input validate" id="password_confirmation" name="password_confirmation" 
					data-rules="required" data-display="确认密码" placeholder="输入密码">
				 <span class="m-field-error"></span> 
			</div>
             
		    </div>
			{{Form::token()}}
		    <p><button type="submit" class="m-btn">注册</button></p>
		    <p class="m-form-error"></p>
		</form>
	</div>
</div>
</script>
<!-- 通知 end -->
@stop


